package com.myapp.myhome.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.content.Context;
import android.widget.Toast;

public class MainUtils {
	Context context;

	public MainUtils(Context context) {
		this.context = context;
	}

	/**
	 * 获取当天日期
	 * */
	public String getDate() {
		Long time = System.currentTimeMillis();
		Date date = new Date(time);
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
		String str_time = dateFormat.format(date);
		return str_time;
	}

	Toast toast;

	public void showToast(String str) {
		if (toast == null) {
			toast = Toast.makeText(context, str, Toast.LENGTH_SHORT);
		}
		toast.setText(str);
		toast.show();
	}
}
